<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Benchmark.Responders.Perlish</title>
    <link rel="stylesheet" href="benchmark_style.css" type="text/css" />
    <script type="text/javascript" src="benchmark.js"></script>
    <script type="text/javascript" src="benchmark_perlish.js"></script>
    <link rel="stylesheet" href="tree.css" type="text/css" />
    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript" src="neodom.js"></script>
    <link type="text/css" rel="stylesheet" href="highlight.css" />
    <script type="text/javascript" src="highlight.js"></script>
    <script type="text/javascript" src="lang_js.js"></script>
  </head>
  <body>
    <h1>
      <a href="benchmark_perlish.js" name="top">Benchmark.Responders.Perlish</a>
      <em><var>Perlish</var> responders suite for <a href="benchmark.html">Benchmark</a></em>
    </h1>

    <ul class="toc tree" id="toc">
      <li><a href="#version">Version</a></li>
      <li><a href="#synopsis">Synopsis</a></li>
      <li><a href="#examples">Examples</a></li>
      <li><a href="#description">Description</a></li>
      <li><a href="#dependencies">Dependencies</a></li>
      <li><a href="#bugs">Bugs</a></li>
      <li><a href="#see-also">See Also</a></li>
      <li><a href="#authors">Authors</a></li>
      <li><a href="#license">License</a></li>
      <li><a href="#disclaimer">Disclaimer</a></li>
    </ul>

    <div class="section">
      <h2><a name="version">Version</a></h2>
      <p id="version-revision"><a href="benchmark_perlish.js">use the source, young padawan!</a></p>
    </div>

    <div class="section">
      <h2><a name="synopsis">Synopsis</a></h2>
<pre><code class="whjs">
new Benchmark(
  { // functions to be benchmarked ...
  },
  { // options ...
    responders: 'Perlish',
    // ... more options ...
  }
);
</code></pre>
    </div>

    <div class="section">
      <h2><a name="examples">Examples</a></h2>
      <p>
        Run any <a href="benchmark.html#examples">Benchmark</a> example,
        using <var>Perlish</var> responders suite.
        Output will look like the following:
      </p>
      <p><a href="benchmark.html#iterations">Iterations limited</a> sample output:</p>
  <pre class="tester tester-finished">
  Browser: Mozilla/5.0 Gecko/20070130 Firefox/2.0.0.1
  Timing 10000 iterations of clean, lazy, reverse...
    clean:   0.234s @  42735/s (n=10000, b=0ms, w=1ms, a=0.02ms)
     lazy:   0.255s @  39216/s (n=10000, b=0ms, w=1ms, a=0.03ms)
  reverse:   0.452s @  22124/s (n=10000, b=0ms, w=222ms, a=0.05ms)
             Rate reverse  lazy clean
  reverse 22124/s      --  -44%  -48%
     lazy 39216/s     44%    --   -9%
    clean 42735/s     48%    9%    --
  Tests duration: 0.941 seconds.
  Total duration: 12.863 seconds.
  </pre>

      <p><a href="benchmark.html#iterations">Duration limited</a> sample output:</p>
  <pre class="tester tester-finished">
  Browser: Mozilla/5.0 Gecko/20070130 Firefox/2.0.0.1
  Running clean, lazy, reverse for at least 1 seconds...
    clean:   1.000s @  30770/s (n=30770, b=0ms, w=232ms, a=0.03ms)
     lazy:   1.167s @  23798/s (n=27772, b=0ms, w=234ms, a=0.04ms)
  reverse:   1.000s @  32041/s (n=32041, b=0ms, w=224ms, a=0.03ms)
             Rate  lazy clean reverse
     lazy 23798/s    --  -23%    -26%
    clean 30770/s   23%    --     -4%
  reverse 32041/s   26%    4%      --
  Tests duration: 3.167 seconds.
  Total duration: 33.530 seconds.
  </pre>

    </div>

    <div class="section">
      <h2><a name="description">Description</a></h2>
      <p>This is <kbd>Benchmark</kbd>'s default responders suite, which generates an
        output similar to Perl's Benchmark.pm</p>

      <p>Explaining the previous <a href="#examples"> example</a>:</p>

      <p>First line describes <em>the browser</em> running the benchmark.</p>
      <p>Second line gives a brief benchmark summary:
        what functions are to be run? for how long?
      </p>
      <p>
        Next, there is a block summarizing each method timing results.
        There is one line per method, ordered alphabetically.
        Each such line contains:
      </p>
      <ol>
        <li>method name: <samp>clean</samp></li>
        <li>total duration (seconds): <samp>0.234s</samp></li>
        <li>average running rate (per second): <samp>42735/s</samp></li>
        <li>number of method executions: <samp>n=10000</samp></li>
        <li>best running time (milliseconds): <samp>b=0ms</samp></li>
        <li>worst running time (milliseconds): <samp>w=232ms</samp></li>
        <li>average running time (milliseconds): <samp>a=0.03ms</samp></li>
      </ol>
      <p>
        Next, there's the <em>comparison block</em>: it presents the relative
        performance of each method compared to all others.
        There is one line per method, ordered by the averate running rate.
        Each such line contains:
      </p>
      <ol>
        <li>method name: <samp>reverse</samp></li>
        <li>average running rate (per second): <samp>22124/s</samp></li>
        <li>percentile comparison with method <var>X</var>: <samp>-44%</samp>
          <br />Negative numbers mean: <q>this method it's <var>ABC%</var>
            slower than method X</q>
          <br />Positive numbers mean: <q>this method it's <var>ABC%</var>
            faster than method X</q>
        </li>
      </ol>
      <p>
        Finally, there's benchmark duration summary block:
      </p>
      <ol>
        <li>How long did all testing took?
          <samp>Tests duration: 0.941 seconds</samp></li>
        <li>How long did all this procedure took?
          <samp>Total duration: 12.863 seconds</samp></li>
      </ol>

    </div>

    <div class="section">
      <h2><a name="dependencies">Dependencies</a></h2>
      <p>None.</p>
    </div>

    <div class="section">
      <h2><a name="bugs">Bugs and Limitations</a></h2>
      <p>No bugs have been reported.</p>
    </div>

    <div class="section">
      <h2><a name="see-also">See Also</a></h2>
      <ul>
        <li><a href="benchmark.html">Benchmark</a></li>
        <li><a href="benchmarker.html">Benchmarker</a></li>
        <li><a href="benchmark_htmlish.html">Benchmark.Responders.HTMLish</a></li>
      </ul>
    </div>

    <div class="section">
      <h2><a name="authors">Authors</a></h2>
      <p>
        <a href="http://www.altblue.com/">Marius Feraru</a>,
        &lt;<a href="mailto:altblue@n0i.net">altblue@n0i.net</a>&gt;.
      </p>
    </div>

    <div class="section">
      <h2><a name="license">License and Copyright</a></h2>
      <p>
        &copy; 2006-2007 Marius Feraru &lt;altblue@n0i.net&gt;.
        All rights reserved.
      </p>
      <p>
        This module is free software; you can redistribute it
        and/or modify it under the same terms as Perl itself.
      </p>
    </div>

    <div class="section">
      <h2><a name="disclaimer">Disclaimer of Warranty</a></h2>
      <p>
        Because this software is licensed free of charge, there is no warranty
        for the software, to the extent permitted by applicable law. Except when
        otherwise stated in writing the copyright holders and/or other parties
        provide the software "as is" without warranty of any kind, either
        expressed or implied, including, but not limited to, the implied
        warranties of merchantability and fitness for a particular purpose.
        The entire risk as to the quality and performance of the software is
        with you. should the software prove defective, you assume the cost
        of all necessary servicing, repair, or correction.
      </p>
      <p>
        In no event unless required by applicable law or agreed to in writing
        will any copyright holder, or any other party who may modify and/or
        redistribute the software as permitted by the above license, be liable
        to you for damages, including any general, special, incidental,
        or consequential damages arising out of the use or inability to use
        the software (including but not limited to loss of data or data being
        rendered inaccurate or losses sustained by you or third parties or a
        failure of the software to operate with any other software), even if
        such holder or other party has been advised of the possibility of such
        damages.
      </p>
    </div>

    <script type="text/javascript">
      var hl = new Highlighter(false); hl.init();
      new Tree($('toc'));
      document.getElementById('version-revision').innerHTML = Benchmark.Responders.Perlish.toString();
    </script>
  </body>
</html>
